home *** CD-ROM | disk | FTP | other *** search
/ PC Users 1998 November / Cd users extra 14.iso / prog / inst / pcu / inis / frmprinc.frm (.txt) next >
Encoding:
Visual Basic Form  |  1998-10-12  |  4.5 KB  |  137 lines

  1. VERSION 5.00
  2. Begin VB.Form frmPrinc 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Archivos INI"
  5.    ClientHeight    =   2055
  6.    ClientLeft      =   45
  7.    ClientTop       =   330
  8.    ClientWidth     =   5280
  9.    Icon            =   "frmPrinc.frx":0000
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   2055
  14.    ScaleWidth      =   5280
  15.    StartUpPosition =   2  'CenterScreen
  16.    Begin VB.CommandButton cmdSalir 
  17.       Caption         =   "Salir"
  18.       Height          =   375
  19.       Left            =   4200
  20.       TabIndex        =   9
  21.       Top             =   1440
  22.       Width           =   855
  23.    End
  24.    Begin VB.Frame Frame1 
  25.       Caption         =   " Valor a escribir "
  26.       BeginProperty Font 
  27.          Name            =   "MS Sans Serif"
  28.          Size            =   9.75
  29.          Charset         =   0
  30.          Weight          =   400
  31.          Underline       =   0   'False
  32.          Italic          =   0   'False
  33.          Strikethrough   =   0   'False
  34.       EndProperty
  35.       Height          =   1575
  36.       Left            =   240
  37.       TabIndex        =   2
  38.       Top             =   120
  39.       Width           =   3135
  40.       Begin VB.TextBox txtValor 
  41.          Height          =   285
  42.          Left            =   840
  43.          TabIndex        =   8
  44.          Top             =   1080
  45.          Width           =   2055
  46.       End
  47.       Begin VB.TextBox txtClave 
  48.          Height          =   285
  49.          Left            =   840
  50.          TabIndex        =   7
  51.          Top             =   720
  52.          Width           =   2055
  53.       End
  54.       Begin VB.TextBox txtSeccion 
  55.          Height          =   285
  56.          Left            =   840
  57.          TabIndex        =   6
  58.          Top             =   360
  59.          Width           =   2055
  60.       End
  61.       Begin VB.Label Label3 
  62.          AutoSize        =   -1  'True
  63.          Caption         =   "Valor:"
  64.          Height          =   195
  65.          Left            =   120
  66.          TabIndex        =   5
  67.          Top             =   1080
  68.          Width           =   405
  69.       End
  70.       Begin VB.Label Label2 
  71.          AutoSize        =   -1  'True
  72.          Caption         =   "Clave:"
  73.          Height          =   195
  74.          Left            =   120
  75.          TabIndex        =   4
  76.          Top             =   720
  77.          Width           =   450
  78.       End
  79.       Begin VB.Label Label1 
  80.          AutoSize        =   -1  'True
  81.          Caption         =   "Secci
  82.          Height          =   195
  83.          Left            =   120
  84.          TabIndex        =   3
  85.          Top             =   360
  86.          Width           =   630
  87.       End
  88.    End
  89.    Begin VB.CommandButton cmdLeer 
  90.       Caption         =   "Leer ARCH.INI"
  91.       Height          =   495
  92.       Left            =   3480
  93.       TabIndex        =   1
  94.       Top             =   840
  95.       Width           =   1575
  96.    End
  97.    Begin VB.CommandButton cmdEscribir 
  98.       Caption         =   "Escribir ARCH.INI"
  99.       Height          =   495
  100.       Left            =   3480
  101.       TabIndex        =   0
  102.       Top             =   240
  103.       Width           =   1575
  104.    End
  105. Attribute VB_Name = "frmPrinc"
  106. Attribute VB_GlobalNameSpace = False
  107. Attribute VB_Creatable = False
  108. Attribute VB_PredeclaredId = True
  109. Attribute VB_Exposed = False
  110. Option Explicit
  111. Private Sub cmdEscribir_Click()
  112.    Dim S As String    'Seccion a escribir
  113.    Dim C As String    'Clave a escribir
  114.    Dim V As String    'Valor a escribir
  115.    S = txtSeccion     'Cargo el contenido de
  116.    C = txtClave       'las cajas de texto en variables que
  117.    V = txtValor       'puedan ser pasadas a la funci
  118.    'Escribo finalmente en el archivo INI
  119.    Call WritePrivateProfileString(S, C, V, "ARCH.INI")
  120. End Sub
  121. Private Sub cmdLeer_Click()
  122.    Dim S As String         'Seccion de la cual leer
  123.    Dim C As String         'Clave a leer
  124.    Dim V As String * 128   'Variable donde situar el valor leido
  125.    Dim CarsLeidos As Long  'Caracteres leidos
  126.    S = txtSeccion + Chr(0) 'Los parametros que se pasan a la
  127.    C = txtClave + Chr(0)   'funcion son Strings
  128.    V = Space(128)          'Lleno la cadena de espacios
  129.    CarsLeidos = GetPrivateProfileString(S, C, "ERROR", V, 128, "ARCH.INI")
  130.    'Tomo la parte importante de la cadena devuelta por la funci
  131.    'y la pongo en la caja de texto "Valor"
  132.    txtValor = Left(V, CarsLeidos)
  133. End Sub
  134. Private Sub cmdSalir_Click()
  135.    End
  136. End Sub
  137.